// player.c

#include "types.h"

char *names[ MAX_NAMES ] = {
   "Marc", "Jill", "Elise", "Megan", "Rosie", "Maddie", "Zoe", "Sunny", "Sally", "Thomas",
   "Ronald", "Tim", "Alan", "John", "Bert", "Ernie", "Wyatt", "Vanessa", "Tony", "Jody"
};

survivor_t Survivors[ MAX_SURVIVORS ];

void SurvivorsInit( void )
{
   int i;

   for ( i = 0 ; i < MAX_SURVIVORS ; i++ )
   {
      Survivors[ i ].name = getRand( MAX_NAMES );
      Survivors[ i ].health = 100 - getRand( 10 );
      Survivors[ i ].hunger = 0 + getRand( 20 );
      Survivors[ i ].rested = 100 - getRand( 20 );
      Survivors[ i ].scavange = 3 + getRand( 3 );
      Survivors[ i ].awareness = 3 + getRand( 3 );
      Survivors[ i ].building = 3 + getRand( 3 );
      Survivors[ i ].fighting = 3 + getRand( 3 );
   }

   return;
}

int SurvivorsAlive( void )
{
   int i;

   for ( i = 0 ; i < MAX_SURVIVORS ; i++ )
   {
      if ( Survivors[ i ].health > 0 ) return 1;
   }

   return 0;
}

void SurvivorsPrintStats( void )
{
   int i;

   printf( "\nSurvivor Stats\n" );
   printf( "\nName      Health  Rested  Hunger  SCV  AWA  BLD  FGT" );
   printf( "\n--------  ------  ------  ------  ---  ---  ---  ---" );

   for ( i = 0 ; i < MAX_SURVIVORS ; i++ )
   {
      printf( "\n%8s  %6d  %6d  %6d  %3d  %3d  %3d  %3d", 
               names[ Survivors[ i ].name ], 
               Survivors[ i ].health, Survivors[ i ].rested, Survivors[ i ].hunger,
               Survivors[ i ].scavange, Survivors[ i ].awareness,
               Survivors[ i ].building, Survivors[ i ].fighting );
   }

   printf("\n\n");

   return;
}


